package com.baihao.consumer;

import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.*;
import org.springframework.stereotype.Component;

/**
 * 消息消费者
 * @author: BaiHao
 * @date: 2020-03-11 下午 04:33
 */
@Component
@RabbitListener(
        bindings = @QueueBinding(value=@Queue(value = "${order.fanout.queue}",autoDelete = "false"),
                exchange = @Exchange(value="${order.fanout.exchange}",type = ExchangeTypes.DIRECT),
        key = "order")
)
public class TestConsumer {

    @RabbitHandler
    public void receviedMessage(Object object)
    {
        System.out.println("消息消费者-------->"+object.toString());
    }
}
